<%--

<!------------------------------------------------------------------------------
 - Copyright 2007 CORE Solutions Limited
 - All rights reserved.
 - PROPRIETARY AND CONFIDENTIAL INFORMATION.
 - Use is subject to license terms.
 -
 - FUNCTION ID      :   CATALOG_SECURITY
 - AUTHOR           :   Saint Peng 
 - DATE CREATE      :   2007/03/29
 - DESCRIPTION      :   a MAINTENANCE CONTENT JSP file for the function, CATALOG_SECURITY
 -                  :   
 -                  :   
 -                  :   
 -
 - MODIFICATION HISTORY:
 - DATE         AUTHOR          VERSION NO.         COMMENT
 - -----------  --------------  ------------------  -------------------
 - 2007/03/29   Saint Peng      1.0                 source is generated.
 -
 -
 -
------------------------------------------------------------------------------->

--%>
<%@ include file="/jsp/com/erp/app/common/jsp/directives_include.jsp"%>

<%@ page import="com.erp.app.catalog.catalogSecurity.vo.CatalogSecurityHdrVo"%>
<%@ page import="com.erp.app.catalog.catalogSecurity.web.CatalogSecurityMaintenanceAction"%>
<%@ page import="com.erp.app.util.web.TabInfo"%>

<%@ include file="/jsp/com/erp/app/common/jsp/html_include.jsp"%>

<% try { %>

<jsp:useBean id="catalogSecurityMaintenanceForm" scope="session" type="com.erp.app.catalog.catalogSecurity.web.CatalogSecurityMaintenanceForm" />

<script language="javascript">

	function doLoad() {
		<%
		if (CommonUtil.nullToString((String)session.getAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE)).equals(ProjectConstants.GENERIC_YES)) {
			session.removeAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE);
			out.println("alert('Records saved.');");
		}
		%>

		<%
		String lastAction = CommonUtil.nullToString(catalogSecurityMaintenanceForm.getPageEvent());
		if (lastAction.equalsIgnoreCase(CatalogSecurityMaintenanceAction.ACTION_ADD_RETRIEVE_DTL)) {
			out.println(WebUtil.openSearchCategoryTreeDo());
		} else if( lastAction.equalsIgnoreCase(CatalogSecurityMaintenanceAction.ACTION_ADD_RETRIEVE_ITEM)  || lastAction.equalsIgnoreCase(CatalogSecurityMaintenanceAction.ACTION_ADD_MY_LIGHTBOX_ITEM)) {
			out.println(WebUtil.openSearchDo());
		}




        if (ProjectConstants.GENERIC_YES.equals((String) session.getAttribute(ProjectConstants.SESSION_ALERT_AFTER_ADD_SECURITY_DTL))){
			session.removeAttribute(ProjectConstants.SESSION_ALERT_AFTER_ADD_SECURITY_DTL);
			String alMsg = (String) session.getAttribute(ProjectConstants.SESSION_ITEM_ALEADY_EXISTS_ITEMS);
			session.removeAttribute(ProjectConstants.SESSION_ITEM_ALEADY_EXISTS_ITEMS);
			out.println("alert('" + alMsg + " are not added, cause they are already exists');");
		}
		if (lastAction.equalsIgnoreCase(CatalogSecurityMaintenanceAction.ACTION_COPY_FROM_OTHER_USER)) {
			out.println(WebUtil.openSearchDo());
		}		

        if (ProjectConstants.GENERIC_YES.equals((String) session.getAttribute(ProjectConstants.SESSION_ALERT_AFTER_ADD_SECURITY_ITEM))){
			session.removeAttribute(ProjectConstants.SESSION_ALERT_AFTER_ADD_SECURITY_ITEM);
			String alMsg = (String) session.getAttribute(ProjectConstants.SESSION_ITEM_ALEADY_EXISTS_ITEMS);
			session.removeAttribute(ProjectConstants.SESSION_ITEM_ALEADY_EXISTS_ITEMS);
			out.println("alert('" + alMsg + " are not added, cause they are already exists');");
		}
        
        if (ProjectConstants.GENERIC_YES.equals((String) session.getAttribute(ProjectConstants.SESSION_ALERT_AFTER_ADD_MY_LIGHTBOX_ITEM))){
			session.removeAttribute(ProjectConstants.SESSION_ALERT_AFTER_ADD_MY_LIGHTBOX_ITEM);
			String alMsg = (String) session.getAttribute(ProjectConstants.SESSION_ITEM_ALEADY_EXISTS_ITEMS);
			session.removeAttribute(ProjectConstants.SESSION_ITEM_ALEADY_EXISTS_ITEMS);
			out.println("alert('" + alMsg + " are not added, cause they are already exists');");
		}

		if (!CommonUtil.isEmpty((String)session.getAttribute(
			ProjectConstants.POP_UP_CATALOG_TREE_DUPLICATE_NODE_ID_SET))) {
			String alMsg = (String) session.getAttribute(
				ProjectConstants.POP_UP_CATALOG_TREE_DUPLICATE_NODE_ID_SET);
			session.removeAttribute(ProjectConstants.POP_UP_CATALOG_TREE_DUPLICATE_NODE_ID_SET);
			out.println("alert('" + alMsg + " are not added, cause they are already exists');");
		}
        
        %>
	}

</script>

<body onLoad="javascript:doLoad();">
<html:form action="/catalogSecurityMaintenance">

<html:hidden property="pageEvent"/>
<html:hidden property="pageMode"/>

<html:hidden property="pageEventSrc"/>

<table class="table_top" nowrap>

<tr>
	<td>
		<chtml:button form="catalogSecurityMaintenanceForm" pageEvent="<%=CatalogSecurityMaintenanceAction.ACTION_EXIT%>"
			styleClass="button1"/>
		<chtml:button form="catalogSecurityMaintenanceForm" pageEvent="<%=CatalogSecurityMaintenanceAction.ACTION_SEARCH%>"
			styleClass="button1"/>
		<chtml:button form="catalogSecurityMaintenanceForm" pageEvent="<%=CatalogSecurityMaintenanceAction.ACTION_SAVE%>"
			styleClass="button1"/>
		<chtml:button form="catalogSecurityMaintenanceForm" pageEvent="<%=CatalogSecurityMaintenanceAction.ACTION_REFRESH%>"
			styleClass="button1"/>
		<chtml:button form="catalogSecurityMaintenanceForm" pageEvent="<%=CatalogSecurityMaintenanceAction.ACTION_COPY_FROM_OTHER_USER%>"
			styleClass="button1"/>			
	</td>
</tr>

</table>

<font color='red'><html:errors /></font>

<div id="tabsF"><ul><%
	
	TableSchema ts = catalogSecurityMaintenanceForm.getTs();
	
	TabInfo[] tabInfos = new TabInfo[] {
	 new TabInfo()
			.setPageEvent(CatalogSecurityMaintenanceAction.ACTION_CHANGE_FOLDER_DTL)
			.setTitle(ts.getDisplayWebLabelByObjectId("LBL_TAB_DTL"))
			.setHidden(false)
			.setTabJsp("CatalogSecurityDtlTab.jsp"),
	new TabInfo()
			.setPageEvent(CatalogSecurityMaintenanceAction.ACTION_CHANGE_FOLDER_FIELDS)
			.setTitle(ts.getDisplayWebLabelByObjectId("LBL_TAB_FIELDS"))
			.setHidden(false)
			.setTabJsp("CatalogSecurityFieldTab.jsp")
	};
	TabInfo currentTab = null;
	for (int i = 0; i < tabInfos.length; ++i) {
		if (catalogSecurityMaintenanceForm.getFolderIdx().equals(String.valueOf(i))) {
			currentTab = tabInfos[i];
		}
		if (tabInfos[i].isHidden()) continue;
		%><chtml:button useExtensions="true" uiType="tab" form="catalogSecurityMaintenanceForm" pageEvent="<%=tabInfos[i].getPageEvent()%>" pageEventSrc="<%=String.valueOf(i)%>" /><%
	}
	
%></ul></div>
<div class="titlebar"><span class="headertitletext"><%=currentTab.getTitle()%></span></div>
<div class="maintenance_content">
<jsp:include page="Catalog_securityCommon.jsp" flush="true"/>
<jsp:include page="<%=currentTab.getTabJsp()%>" flush="true"/>
</div>
</html:form>

<% } catch(Exception e) { e.printStackTrace(); } %>
